Skip to content

fix: delegate all cloud credentials for recursive spawn#2994

Merged
la14-1 merged 1 commit intoOpenRouterTeam:mainfrom
AhmedTMM:fix/delegate-all-cloud-creds
Mar 26, 2026
Merged

fix: delegate all cloud credentials for recursive spawn#2994
la14-1 merged 1 commit intoOpenRouterTeam:mainfrom
AhmedTMM:fix/delegate-all-cloud-creds

Conversation

@AhmedTMM
Copy link
Collaborator

Summary

  • delegateCloudCredentials only copied the current cloud's config (e.g. sprite.json when spawning on Sprite)
  • Child VMs couldn't spawn on other clouds (DigitalOcean, Hetzner, etc.) because their tokens were never forwarded
  • Now iterates all known clouds (hetzner, digitalocean, aws, gcp, sprite) and copies every credential file that exists locally

Test plan

  • spawn claude sprite --beta recursive → on VM: ls ~/.config/spawn/ shows all cloud configs that exist on host
  • Agent on VM can run spawn codex digitalocean --headless using delegated DO token

🤖 Generated with Claude Code

louisgv
louisgv previously approved these changes Mar 26, 2026
Copy link
Member

@louisgv louisgv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Security Review

Verdict: APPROVED
Commit: 248621f

Findings

No security vulnerabilities found.

Analysis

  • Removed validation of cloudName parameter is safe (parameter now unused, cloud names hardcoded)
  • No command injection risk: file.remotePath constructed from hardcoded cloud names only
  • No path traversal: all paths use hardcoded cloud names from literal array
  • Credential handling appropriate: chmod 600 on files, chmod 700 on directory
  • Base64 encoding prevents shell metacharacter injection

Tests

  • bash -n: N/A (no shell scripts modified)
  • bun test: PASS (1964 tests passed, 0 failed)
  • curl|bash: N/A (no install scripts modified)
  • macOS compat: N/A (no shell scripts modified)

-- security/pr-reviewer

Copy link
Member

@louisgv louisgv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Security Review

Verdict: APPROVED
Commit: faa693e

Summary

This PR improves credential delegation for recursive spawning by changing from single-cloud to all-cloud credential forwarding.

Security Analysis

Command Injection - IMPROVED

  • OLD: Used regex validation on dynamic cloudName parameter
  • NEW: Uses hardcoded whitelist of cloud names (["hetzner", "digitalocean", "aws", "gcp", "sprite"])
  • RESULT: Eliminates any potential for command injection via crafted cloud names

Credential Handling - SECURE

  • Credentials base64-encoded during transmission (line 193)
  • Remote files get chmod 600 (line 195)
  • Config directory gets chmod 700 (line 184)
  • Proper error handling with asyncTryCatch

Path Traversal - OK

  • All paths constructed via trusted getSpawnCloudConfigPath() function
  • No user-controlled input in file paths

Findings

None. This is a security improvement.

Tests

  • bun test: PASS (1955 tests pass)
  • Credential delegation tests verified
  • No regressions

Recommendation

Approve and merge. The change from dynamic cloud name to hardcoded whitelist eliminates injection risks while enabling the intended feature (recursive spawn across any cloud).


-- security/pr-reviewer

@louisgv
Copy link
Member

louisgv commented Mar 26, 2026

Rebased on latest main (0.26.6 → 0.26.7 version bump to resolve conflict)

@louisgv
Copy link
Member

louisgv commented Mar 26, 2026

Temporarily closing to refresh PR state after force push

@louisgv louisgv closed this Mar 26, 2026
@louisgv louisgv reopened this Mar 26, 2026
delegateCloudCredentials only copied the current cloud's config file
(e.g. sprite.json when spawning on Sprite). Child VMs couldn't spawn
on other clouds because their tokens weren't forwarded.

Now iterates all known clouds and copies every credential file that
exists locally, so the agent can spawn children on any cloud.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@la14-1 la14-1 force-pushed the fix/delegate-all-cloud-creds branch from faa693e to 55a7a14 Compare March 26, 2026 02:00
@la14-1 la14-1 merged commit 7fe36b8 into OpenRouterTeam:main Mar 26, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants